# Contributor: André Klitzing <aklitzing@gmail.com>
# Maintainer: André Klitzing <aklitzing@gmail.com>
pkgname=rbtools
pkgver=5.0
pkgrel=0
pkgdesc="Client tools for Review Board"
url="https://www.reviewboard.org/docs/releasenotes/rbtools/"
# pydiffx
arch="noarch !s390x"
license="MIT"
depends="
	py3-certifi
	py3-colorama
	py3-texttable
	py3-tqdm
	py3-typing-extensions
	py3-housekeeping
	py3-packaging
	py3-importlib-metadata
	py3-importlib-resources
	pydiffx
	python3
	"
makedepends="
	py3-gpep517
	py3-wheel
	py3-setuptools
	"
checkdepends="
	py3-kgb
	py3-pytest
	py3-pytest-env
	"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/R/RBTools/RBTools-$pkgver.tar.gz"
builddir="$srcdir/RBTools-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	# skip tests that either need special tools or are outdated
	.testenv/bin/python3 -m pytest \
		--ignore rbtools/clients/tests/test_svn.py \
		--ignore rbtools/clients/tests/test_scanning.py \
		--ignore rbtools/utils/tests/test_source_tree.py \
		--deselect=rbtools/clients/tests/test_cvs.py \
		--deselect=rbtools/clients/tests/test_git.py \
		--deselect=rbtools/clients/tests/test_mercurial.py \
		--deselect=rbtools/utils/tests/test_console.py \
		--deselect=rbtools/diffs/tests/test_apple_diff_tool.py \
		--deselect=rbtools/clients/tests/test_base_scmclient.py
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl

	# cleanup tests
	find "$pkgdir" \( -name "tests" -o -name "testing" \) -a -type d -exec rm -r {} \+
}

sha512sums="
74d9e195cf74c723b58cf1c0e0c500fa1e441590bb3febd51bd05d81b2d4c30ef4d4ad5db56e605b6cb9801bcdfbd3d13cecbc29f4a2d628fe1e0cb946ac91bf  RBTools-5.0.tar.gz
"
